

class MCPError(Exception):
    def __init__(self, code,message):
        self.message = message
        self.code = code

def mcp_server_handle(request:dict):
    #模拟服务器
    if 'method' in request:
        raise MCPError(code=-32600,message='Method Not Allowed')
    if request['method'] not in  ['ping','status']:
        raise MCPError(code=-32601,message='Method Not Allowed')